package client_gui;
import client_controllers.*;
import client_controllers.EmployeeLoginController.ExitListener;
import java.awt.BorderLayout;
import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.border.EmptyBorder;
import javax.swing.JButton;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.WindowEvent;
import java.awt.GridLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import javax.swing.border.TitledBorder;
import net.miginfocom.swing.MigLayout;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import java.awt.Checkbox;
import java.awt.Frame;
import java.awt.Label;
import java.awt.TextArea;
import java.awt.TextField;
import java.io.Serializable;
import javax.swing.JLabel;
import javax.swing.JPasswordField;

public class EmployeeLogInGUI extends JFrame implements Serializable {
	/**
	 * @class EmployeeLogInGUI checks fields for employee authorization.
	 */

	private JPanel contentPane;
	private TextField tf_id; // text field for id
	private JButton login;
	private JButton exit;
	private JLabel msg;
	private JPasswordField tf_pass;

	public EmployeeLogInGUI() {
		
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setTitle("Emloyee Login");
		setBounds(100, 100, 263, 208);
		setLocationRelativeTo(null);
		contentPane = new JPanel();
		contentPane.setBorder(new EmptyBorder(20, 20, 20, 20));
		contentPane.setSize(400,400);
		setContentPane(contentPane);
		contentPane.setLayout(new MigLayout("", "[57px][51px][grow][][][][grow][][grow][][][][][][][][][]", "[][][][23px][][][][][][]"));
		
		msg = new JLabel("");
		msg.setVisible(false);
		contentPane.add(msg, "cell 1 2 2 1,growx");
				
		Label label = new Label("User ID:");
		contentPane.add(label, "cell 1 4");
		
		tf_id = new TextField(10);
		contentPane.add(tf_id, "cell 2 4");
		
		Label label_1 = new Label("Password");
		contentPane.add(label_1, "cell 1 5");
		
		tf_pass = new JPasswordField();
		contentPane.add(tf_pass, "cell 2 5,growx");
		
			
		login = new JButton("Login");
		login.setBackground(Color.CYAN);

		contentPane.add(login, "cell 1 8,alignx left,aligny top");	
		exit = new JButton("exit");
		exit.setBackground(Color.ORANGE);
		contentPane.add(exit, "cell 2 8,alignx left,aligny top");
		setVisible(true);
		EmployeeLoginController elc=new EmployeeLoginController(this);
		
	}
		
	public int get_tf_id(){
		return Integer.parseInt(tf_id.getText());
	}
	public String get_tf_pass(){
		return tf_pass.getText();
	}
	public JButton get_login_button(){
		return this.login;
	}
	public JButton get_exit_button(){
		return this.exit;
	}
	public TextField getTf_id() {
		return tf_id;
	}
	public void setTf_id(TextField tf_id) {
		this.tf_id = tf_id;
	}

	public JPasswordField getTf_pass() {
		return tf_pass;
	}

	public void setTf_pass(JPasswordField tf_pass) {
		this.tf_pass = tf_pass;
	}

	public JLabel getMsg() {
		return msg;
	}
}
